home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Dylan Related / MacMarlais 0.5.4 ƒ / Information / DIFFERENCES < prev    next >
Encoding:
Text File  |  1994-09-18  |  6.3 KB  |  220 lines  |  [TEXT/KAHL]

  1. Marlais is an implementation of a Dylan-like language.
  2.  
  3. In the spirit of the Larry Tesler's foreword to the Dylan Book[1],
  4. Marlais supports a language with multiple syntaxes atop the
  5. extremely neutral base of Lisp.
  6.  
  7. The default infix syntax provided by Marlais is based on the description
  8. of Dylan given in the Dylan Interim Reference Manual (DIRM) [2].  Marlais
  9. does not implement that language in its entirety, and differs in some
  10. specific ways noted below.
  11.  
  12. The alternative prefix syntax is a modification of the syntax defined in
  13. the Dylan Book.  The modifications have been made to support the semantics
  14. described in the DIRM with as little change as possible.
  15.  
  16. The Marlais interpreter can be operated in either infix or prefix
  17. syntax mode.  The mode can be changed or asserted during execution by
  18. use of the built-in methods `infix' and `prefix'.  By default, Marlais
  19. starts in infix syntax mode.  To initiate an interpreter session using
  20. prefix syntax, one may use the '-c' command-line argument.
  21.  
  22. Here are the major semantic differences between Marlais and the DIRM and
  23. Dylan Book specification of Dylan.
  24.  
  25. * Marlais supports modules and evaluates expressions with respect to a
  26. current-module's namespace.  One can get the current module with
  27.  
  28.     current-module ()
  29.  
  30. and one can set the current module with
  31.  
  32.     set-module (new-module)
  33.  
  34. * Modules have fledgling support as of version 0.5.3.
  35. `define module' works with simple use clauses.  The following example
  36. shows the implemented behavior:
  37.  
  38. Contents of the file foo.dyl:
  39.  
  40.     module: foo
  41.  
  42.     define variable x = 10;
  43.  
  44. Interpreter session:
  45.  
  46.     Marlais 0.5.3
  47.     ? define module foo
  48.     >   use dylan-user, export: all;
  49.     >   end;
  50.     ? current-module ();
  51.     foo
  52.     ? set-module (dylan-user);
  53.     ? load ("/tmp/foo.dyl");
  54.     ? current-module ();
  55.     dylan-user
  56.     ? x;
  57.     error: unbound variable: x.
  58.     ? set-module (foo);
  59.     ? x;
  60.     10
  61.     ? define module uses-foo
  62.     >   use foo;
  63.     >   end;
  64.     ? current-module ();
  65.     uses-foo
  66.     ? x;
  67.     10
  68.     ? x := 5;
  69.     5
  70.     ? set-module (foo);
  71.     ? x;
  72.     5
  73.     ? set-module (dylan-user);
  74.     ? x;
  75.     error: unbound variable: x.
  76.  
  77.  
  78. Prefix support for modules:
  79.  
  80.     (define-module module-name clauses_opt)
  81.  
  82. where
  83.     clauses_opt is one of
  84.         (use used-module-name module-options_opt)
  85.         (export variables)
  86.         (create variables)
  87.  
  88.     module-options is one of
  89.         (import: imports)
  90.         (exclude: variable_names)
  91.         (prefix: string)
  92.         (rename: rename-specs)
  93.         (export: variable-names)
  94.  
  95.     an import is of the form
  96.         variable-name or
  97.         rename-spec
  98.  
  99.     a rename-spec is of form
  100.         (old-variable-name new-variable-name)
  101.  
  102. * Conditions are not yet implemented in a reasonable way.  Condition
  103. classes exist, but beyond that, there's very little.
  104.  
  105. * The prefix notation for `for' has been modified as follows:
  106.  
  107.     (`for' (clause- ... clause-n)
  108.          (test result-1 ... result-n)
  109.              expr-1 ... expr-n)
  110.  
  111. where a clause takes one the following three forms:
  112.  
  113.     (variable init step)
  114.     (`collection:' variable collection)
  115.     (`range:' variable start [{`to' | `above' | `below'} bound]
  116.                                  [`by' increment])
  117.  
  118. The behavior of `for' using these forms conforms to the DIRM specification
  119. of form w.r.t. explicit step clauses, collection clauses, and numeric
  120. clauses, respectively.
  121.  
  122. * The `block' control construct is not yet implemented.  If
  123. you REALLY need to bind an exit procedure right now, you can do this
  124. hackish sort of thing:
  125.  
  126.     bind-exit (signal(), (begin print ("hi"); signal ("ho"); end));
  127.  
  128. This is ROUGHLY equivalent to the following prefix Dylan code:
  129.  
  130.     (bind-exit (signal) (print "hi") (signal "ho"))
  131.  
  132. Don't get in the habit of doing this, please, block will be here soon.
  133.  
  134. * The handler form of `let' is not yet implemented.
  135.  
  136. * Marlais supports the iteration protocol of the Dylan book [1] (albeit
  137.     somewhat feebly) in addition to the iteration protocol of the DIRM.
  138.  
  139. * Element setter functions conform to the argument order of the
  140.     original Dylan book [1], i.e.,
  141.  
  142.     element-setter ( object, arg1, ...  argn, new-value)
  143.  
  144. * class initialization argument specifications are not supported.
  145.  
  146. * Limited integer types *are* supported. (Design Note 6).
  147.  
  148. * Union Types *are* supported. (Design Note 7).
  149.     
  150. * Builtin classes - Builtin classes are represented differently from
  151. classes defined with DEFINE-CLASS and (make <class> ...)
  152.  
  153. * Incomplete class hierarchy.  The collection classes are spotty.
  154. There is no support for <stretchy-vector>.
  155.  
  156. * Error handling - There is very little support for error handling and
  157. conditions.   Basically there is just an (error ...) function.
  158.  
  159. * Numeric operations - Only the numeric operations that I needed were
  160. included.  See the file HACKING for information on adding these
  161. functions yourself.
  162.  
  163. * Weak links - Not supported. (See note on pg. 93 of the Dylan book [2].)
  164.  
  165. * Misc - If there is a feature missing that you need, let us know.  It
  166. will have a better chance of making it into the next release.
  167.  
  168. There are several additional features that have been added.
  169.  
  170. * Simple stream I/O - There were only passing allusions to I/O in the
  171. Dylan book.  Marlais has added the following I/O features:
  172.  
  173.     <stream> builtin class
  174.     open-input-file (<string>) => <stream>
  175.     open-output-file (<string>) => <stream>
  176.     close-stream (<stream>) => unspecified
  177.     eof-object? (<object>) => <boolean>
  178.     print (<object>) => unspecified
  179.     princ (<object>) => unspecified
  180.     format ((union <stream> #t) <string> arg1 arg2 ...) => unspecified
  181.     read ([<stream>]) => <object>
  182.     read-char ([<stream>]) => <character>
  183.  
  184. * Syntax mode and loading Dylan files
  185.  
  186.     infix () => unspecified
  187.         Switch the current syntax mode to infix.
  188.     prefix () => unspecified
  189.         Switch the current syntax mode to prefix.
  190.  
  191.     load (<string>) => unspecified
  192.         Loads a Dylan file containing contents whose syntax 
  193.         matches the current syntax mode.
  194.     i-load (<string>) => unspecified
  195.         Loads an infix syntax Dylan file.
  196.     p-load (<string>) => unspecified
  197.         Loads a prefix syntax Dylan file.
  198.  
  199. * Other handy features
  200.  
  201.     ctime() => <string>
  202.         returns day-date-time string
  203.     time() => <integer>
  204.         returns low order bits of number of seconds since
  205.         some system-defined referent.
  206.     clock() => <integer>
  207.         returns number of milliseconds used by process.
  208.  
  209. * Leaving Marlais - The functions QUIT and BYE are provided for
  210. leaving Marlais.
  211.  
  212. ---
  213. [1] Andrew Shalit.  "Dylan: an object oriented dynamic language".
  214. Apple Computer, Inc.  1992.
  215.  
  216. [2] Andrew Shalit, Orca Starbuck, et. al. "Dylan (TM) Interim Reference Manual.
  217. Apple Computer, Inc.  1992-1994
  218.  
  219. [3] Various Authors.  "Dylan Design Notes".  Apple Computer, Inc.  1993-1994.
  220.